tests: split utility function out into common.inc
authorØyvind Kolås <pippin@gimp.org>
Wed, 2 May 2012 21:00:46 +0000 (23:00 +0200)
committerØyvind Kolås <pippin@gimp.org>
Wed, 2 May 2012 21:00:46 +0000 (23:00 +0200)
tests/common.inc [new file with mode: 0644]
tests/extract.c
tests/floatclamp.c
tests/palette.c

diff --git a/tests/common.inc b/tests/common.inc
new file mode 100644 (file)
index 0000000..8d573fd
--- /dev/null
@@ -0,0 +1,24 @@
+
+#define CHECK_CONV(test_name, componenttype, src_fmt, dst_fmt, src_pix, expected_pix) \
+  {       \
+  const Babl *fish;       \
+  int i;       \
+  fish = babl_fish (src_fmt, dst_fmt);       \
+  if (!fish)       \
+    {       \
+      printf ("  %s failed to make fish\n", test_name);       \
+      OK = 0;       \
+    }       \
+  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
+    {       \
+      int c;\
+      componenttype result[10];       \
+      babl_process (fish, src_pix[i], result, 1);       \
+      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
+      if (result[c] != expected_pix[i][c])       \
+        {       \
+          printf (" %s failed #%i[%i]  got %i expected %i\n", test_name, i, c, result[c], expected_pix[i][c]);       \
+          OK = 0;          \
+        }       \
+    }       \
+  }
index 038c66757ed5aac3e0a0526663486767736e2f86..f27662bdbb15184d92d02e1f5fa77aea6bff291a 100644 (file)
 #include <stdio.h>
 #include <assert.h>
 #include "babl.h"
-
-
-#define CHECK_CONV(test_name, componenttype, src_fmt, dst_fmt, src_pix, expected_pix) \
-  {       \
-  const Babl *fish;       \
-  int i;       \
-  fish = babl_fish (src_fmt, dst_fmt);       \
-  if (!fish)       \
-    {       \
-      printf ("  %s failed to make fish\n", test_name);       \
-      OK = 0;       \
-    }       \
-  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
-    {       \
-      int c;\
-      componenttype result[10];       \
-      babl_process (fish, src_pix[i], result, 1);       \
-      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
-      if (result[c] != expected_pix[i][c])       \
-        {       \
-          printf (" %s failed #%i[%i]  got %i expected %i\n", test_name, i, c, result[c], expected_pix[i][c]);       \
-          OK = 0;          \
-        }       \
-    }       \
-  }
-
-#include <assert.h>
+#include "common.inc"
 
 int
 main (int    argc,
index 617b440d42077191390c32591c5581c669145150..4ba799242ace3d53b1ab9f01d133a38a161286f8 100644 (file)
 #include <assert.h>
 #include "babl.h"
 
+#include "common.inc"
 
-#define CHECK_CONV(test_name, componenttype, src_fmt, dst_fmt, src_pix, expected_pix) \
-  {       \
-  const Babl *fish;       \
-  int i;       \
-  fish = babl_fish (src_fmt, dst_fmt);       \
-  if (!fish)       \
-    {       \
-      printf ("  %s failed to make fish\n", test_name);       \
-      OK = 0;       \
-    }       \
-  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
-    {       \
-      int c;\
-      componenttype result[10];       \
-      babl_process (fish, src_pix[i], result, 1);       \
-      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
-      if (result[c] != expected_pix[i][c])       \
-        {       \
-          printf (" %s failed #%i[%i]  got %i expected %i\n", test_name, i, c, result[c], expected_pix[i][c]);       \
-          OK = 0;          \
-        }       \
-    }       \
-  }
-
-#include <assert.h>
 
 int
 main (int    argc,
index 6ad517f682b656a56f4da645be2dd99beca60513..aaf98c8e3fdcfe81969e507044ab1f770a9010a6 100644 (file)
 #include <stdio.h>
 #include <assert.h>
 #include "babl.h"
-
-
-#define CHECK_CONV(test_name, componenttype, src_fmt, dst_fmt, src_pix, expected_pix) \
-  {       \
-  const Babl *fish;       \
-  int i;       \
-  fish = babl_fish (src_fmt, dst_fmt);       \
-  if (!fish)       \
-    {       \
-      printf ("  %s failed to make fish\n", test_name);       \
-      OK = 0;       \
-    }       \
-  for (i = 0; i < sizeof(src_pix)/sizeof(src_pix[0]); i ++)       \
-    {       \
-      int c;\
-      componenttype result[10];       \
-      babl_process (fish, src_pix[i], result, 1);       \
-      for (c = 0; c < sizeof(expected_pix[i])/sizeof(expected_pix[i][0]); c++) \
-      if (result[c] != expected_pix[i][c])       \
-        {       \
-          printf (" %s failed #%i[%i]  got %i expected %i\n", test_name, i, c, result[c], expected_pix[i][c]);       \
-          OK = 0;          \
-        }       \
-    }       \
-  }
-
-#include <assert.h>
+#include "common.inc"
 
 int
 main (int    argc,